// copy single object
let target = {};
let source = { a: 1, b: 2, c: 3 };
Object.assign(target, source);
target.d = 4;
console.log(target, source);

// combine multiple objects
target = {};
let obj1 = { a: 1 }, obj2 = { b: 2 }, obj3 = { c: 3 };
Object.assign(target, obj1, obj2, obj3);
console.log(target);

// merge multiple objects
target = { a: 1, b: 2 };
obj1 = { b: 2, c: 2 };
obj2 = { c: 3 };
Object.assign(target, obj1, obj2);
console.log(target);

// copy embedded object
target = {};
source = { a: 1, b: { c: 2, d: 3 } };
Object.assign(target, source);
console.log(target, source);
target.a = 5;
target.b.c = 9;
console.log(target, source);

// copy from multiple sources
let result = Object.assign({}, 'abc', null, true, undefined, 10);
console.log(result);

// single param
console.log(Object.assign({}));
console.log(Object.assign(1));

// merge array
console.log([2, 3], [5]);
